home *** CD-ROM | disk | FTP | other *** search
/ Delphi Informant Complete 1995 - 2000 / Delphi Informant Complete 1995 to 2000.iso / Delphi Informant Magazine Complete Works SOURCE CODE 1998.rar / 1998 / Jul / di9807rl / aniform.pas < prev    next >
Pascal/Delphi Source File  |  1998-02-24  |  2KB  |  68 lines

  1. unit AniForm;
  2.  
  3. { Demostration of palettes and animation in a Delphi component.
  4.   Copyright ⌐ 1998 Tempest Software, Inc.
  5.  
  6.   This program demonstrate some simple uses for a display palette
  7.   in Windows, including palette animation. Palette animation works
  8.   only with video adapters that use a system palette, so if the display
  9.   does not use a palette, the animation start button is disabled.
  10.  
  11.   Most of the interesting stuff is in the Moving.pas file, which
  12.   implements the TMovingGradient component. This is the main form,
  13.   which creates the TMovingGradient component.
  14. }
  15.  
  16. interface
  17.  
  18. uses
  19.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  20.   Forms, Dialogs, StdCtrls, ExtCtrls, Moving, Gradient;
  21.  
  22. type
  23.   TDemoForm = class(TForm)
  24.     Panel1: TPanel;
  25.     StartButton: TButton;
  26.     StopButton: TButton;
  27.     Panel2: TPanel;
  28.     Gradient: TMovingGradient;
  29.     procedure StartButtonClick(Sender: TObject);
  30.     procedure StopButtonClick(Sender: TObject);
  31.     procedure FormCreate(Sender: TObject);
  32.   private
  33.     { Private declarations }
  34.   public
  35.     { Public declarations }
  36.   end;
  37.  
  38. var
  39.   DemoForm: TDemoForm;
  40.  
  41. implementation
  42.  
  43. {$R *.DFM}
  44.  
  45. procedure TDemoForm.StartButtonClick(Sender: TObject);
  46. begin
  47.   StartButton.Enabled := False;
  48.   StopButton.Enabled := True;
  49.   Gradient.Enabled := True;
  50. end;
  51.  
  52. procedure TDemoForm.StopButtonClick(Sender: TObject);
  53. begin
  54.   Gradient.Enabled := False;
  55.   StopButton.Enabled := False;
  56.   StartButton.Enabled := True;
  57. end;
  58.  
  59. procedure TDemoForm.FormCreate(Sender: TObject);
  60. begin
  61.   { Check the display. If it does not use a palette, then do not
  62.     try to animate the palette. }
  63.   if (Rc_Palette and GetDeviceCaps(Canvas.Handle, RasterCaps)) = 0 then
  64.     StartButton.Enabled := False;
  65. end;
  66.  
  67. end.
  68.